package com.zmzncs.lmtc.module.shop.controller;


import com.zmzncs.lmtc.common.pojo.Rest;
import com.zmzncs.lmtc.common.util.QRCodeUtil;
import com.zmzncs.lmtc.common.util.RestUtil;
import com.zmzncs.lmtc.module.shop.pojo.shop_goods.ShopGoods;
import com.zmzncs.lmtc.module.shop.pojo.shop_goods.ShopGoodsDTO;
import com.zmzncs.lmtc.module.shop.pojo.shop_goods.ShopGoodsVO;
import com.zmzncs.lmtc.module.shop.pojo.shop_ticket.ShopTicketDTO;
import com.zmzncs.lmtc.module.shop.service.ShopGoodsService;
import io.micrometer.core.instrument.util.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 商户-商品 前端控制器
 * </p>
 *
 * @author 高博文
 * @since 2021-05-20
 */
@Api(tags = "商户商品信息")
@RestController
@RequestMapping("/shop/shop-goods")
public class ShopGoodsController {

    @Autowired
    ShopGoodsService shopGoodsService;

    @ApiOperation(value = "商品详情")
    @ApiImplicitParams({
        @ApiImplicitParam(name="id", value="商品id", required = true),
    })
    @GetMapping("get-by-id")
    public Rest<ShopGoodsVO> getById(@RequestParam Long id){
        ShopGoodsDTO shopGoodsDTO = shopGoodsService.getById(id);
        ShopGoodsVO shopGoodsVO = new ShopGoodsVO();
        BeanUtils.copyProperties(shopGoodsDTO, shopGoodsVO);

        return RestUtil.success(shopGoodsVO);
    }

}

